package com.biblio.repository;

import org.springframework.stereotype.Repository;

import com.biblio.dom.Account;

@Repository
public class AccountRepository extends BaseRepository<Account> {
	
	public  Account getAccountByEmail(String identifier)  {
        return getSingleOrNullResult( em.createQuery("select a from Account a where lower(a.email) =:mail")
                .setParameter("mail", identifier.toLowerCase())
                );
        }

    public  Account getAccountByUserName(String identifier) {
        return getSingleOrNullResult( 
                em.createQuery("select a from Account a where lower(a.userName) =:userName")
                .setParameter("userName", identifier.toLowerCase())
                );

    }  

}
